import { url } from "inspector";
import { LoginBean } from "../Bean/LoginBean";
import { StaffinfoBean } from "../Bean/StaffinfoBean";
import Abstract from "../util/http/axois/AxiosBase";
import { GetDemo, loginRequest, WxResponse } from "../util/http/axois/AxiosInterface";

const apiUrls = {
  loginUrl: '/StudyNew/StaffLogin',
  getStaffInfo: '/StudyNew/getStaffInfo'
}

class GlobalApi extends Abstract {
  toLogin (data: loginRequest): Promise<WxResponse<LoginBean>> {
    return this.postReq({ url: apiUrls.loginUrl, data, needToken: false })
    // return this.getReq({ url: apiUrls.loginUrl, params })
  }

  getStaffInfo (data: any): Promise<WxResponse<StaffinfoBean>> {
    return this.getReq({ url: apiUrls.getStaffInfo, data })
  }
}

let instance: GlobalApi
export default (() => {
  if (instance) return instance
  instance = new GlobalApi()
  return instance
})
